#import "DataType.h"

NSString* gHDSuffix=@"";
NSString* gFontName=@"Helvetica-Bold";		// 普通
NSString* gFontNumber=@"DBLCDTempBlack";	// 数字

// 0.99, 1.99, 4.99, 9.99, 24.99, 49.99, 99.99
const int gIapGold[IAP_COUNT] = {
	1500, 3500, 9000, 20000, 55000, 125000, 300000
};

InvaderData gInvadersData[INVADERS_COUNT] =
{
	{ IT_Normal_1,	20,		true,	@"Normal1",		2,	NULL, NULL	},
	{ IT_Normal_2,	80,		true,	@"Normal2",		2,	NULL, NULL	},
	{ IT_Good,		0,		true,	@"Good",		2,	NULL, NULL	},
	{ IT_Bad,		-100,	true,	@"Bad",			2,	NULL, NULL	},
	{ IT_Bomb,		0,		false,	@"Bomb",		2,	NULL, NULL	},
	{ IT_Gold,		5,		false,	@"Gold",		8,	NULL, NULL	},
};

SpellData gSpellData[SPELL_COUNT] =
{
 { ST_Small,	@"SNSmall",		@"small.png",	15,	100,	@"SDSmall" },
 { ST_Freeze,	@"SNFreeze",	@"freeze.png",	15,	150,	@"SDFreeze" },
 { ST_Shield,	@"SNShield",	@"shield.png",	20,	250,	@"SDShield" },
 { ST_Bless,	@"SNBless",		@"bless.png",	15,	300,	@"SDBless" },
 { ST_Rare,		@"SNRare",		@"rare.png",	15,	100,	@"SDRare" },
 { ST_Bomb,		@"SNBomb",		@"bomb.png",	0,	250,	@"SDBomb" },
 { ST_Double,	@"SNDouble",	@"double.png",	20,	200,	@"SDDouble" },
 { ST_Burst,	@"SNBurst",		@"burst.png",	15,	150,	@"SDBurst" },
 { ST_Angel,	@"SNAngel",		@"angel.png",	15,	500,	@"SDAngel" },
};

SettingData gSettingData;
GlobalData gGlobalData;

bool gInvadersIsCreated = false;

CGPoint gPointCenter = ccp(240, 160);
CGPoint gAnchorLeft = ccp(0, 0.5);
CGPoint gAnchorRight = ccp(1, 0.5);
CGPoint gAnchorTop = ccp(0.5, 0);
CGPoint gAnchorBottom = ccp(0.5, 1);

DataScore gCurScore;

GCManager* gGCManager = NULL;

bool gWaitingIAP = false;

const NSString* gSoundFile[SOUND_COUNT] = 
{
	@"sound/Music2.mp3",			// 0
	@"sound/Music1.mp3",			// 1
	@"sound/click.mp3",				// 2
	@"sound/btn02.mp3",				// 3
	@"sound/start.mp3",				// 4
	@"sound/finish.mp3",			// 5
	@"sound/col_normal.mp3",		// 6
	@"sound/col_shield.mp3",		// 7
	@"sound/boing.mp3",				// 8
	@"sound/col_gold.mp3",			// 9
	@"sound/col_good.mp3",			// 10
	@"sound/col_bad.mp3",			// 11
	@"sound/col_bomb.mp3",			// 12
	@"sound/cast.mp3",				// 13
	@"sound/coin.mp3",				// 14
};

char* commaprint(int n)
{
	static int comma = ',';
	static char retbuf[30];
	
	char *p = &retbuf[sizeof(retbuf)-1];
	int i = 0;
	
	*p = '\0';
	int m = abs(n);
	do
	{
		if( i % 3 == 0 && i != 0)
			*--p = comma;
		*--p = '0' + m % 10;
		m /= 10;
		i++;
	} while(m != 0);
	
	if(n < 0)
		*--p = '-';
	
	return p;
}